home *** CD-ROM | disk | FTP | other *** search
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- NNNNAAAAMMMMEEEE
- xdr - External Data Representation (XDR) library routines
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS AAAANNNNDDDD DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- These routines allow C programmers to describe arbitrary data structures
- in a machine-independent fashion. Data for remote procedure calls are
- transmitted using these routines.
-
-
- #include <rpc/rpc.h>
-
-
-
- bool_t
- xdr_array(XDR *xdrs, caddr_t *arrp, u_int *sizep,
- u_int maxsize, u_int elsize, xdrproc_t elproc)
-
-
- A filter primitive that translates between variable-length arrays
- and their corresponding external representations. The parameter _a_r_r_p
- is the address of the pointer to the array, while _s_i_z_e_p is the
- address of the element count of the array; this element count cannot
- exceed _m_a_x_s_i_z_e. The parameter _e_l_s_i_z_e is the _s_i_z_e_o_f each of the
- array's elements, and _e_l_p_r_o_c is an XDR filter that translates
- between the array elements' C form, and their external
- representation. This routine returns 1 if it succeeds, 0 otherwise.
-
-
- bool_t
- xdr_bool(XDR *xdrs, bool_t *bp)
-
-
- A filter primitive that translates between booleans (C integers) and
- their external representations. When encoding data, this filter
- produces values of either 1 or 0. This routine returns 1 if it
- succeeds, 0 otherwise.
-
-
- bool_t
- xdr_bytes(XDR *xdrs, char **sp, u_int *sizep,
- u_int maxsize)
-
-
- A filter primitive that translates between counted byte strings and
- their external representations. The parameter _s_p is the address of
- the string pointer. The length of the string is located at address
- _s_i_z_e_p; strings cannot be longer than _m_a_x_s_i_z_e. This routine returns
- 1 if it succeeds, 0 otherwise.
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- bool_t
- xdr_char(XDR *xdrs, char *cp)
-
-
- A filter primitive that translates between C characters and their
- external representations. This routine returns 1 if it succeeds, 0
- otherwise. Note: encoded characters are not packed, and occupy 4
- bytes each. For arrays of characters, it is worthwhile to consider
- _x_d_r__b_y_t_e_s(), _x_d_r__o_p_a_q_u_e() or _x_d_r__s_t_r_i_n_g().
-
-
- void
- xdr_destroy(XDR *xdrs)
-
-
- A macro that invokes the destroy routine associated with the XDR
- stream, _x_d_r_s. Destruction usually involves freeing private data
- structures associated with the stream. Using _x_d_r_s after invoking
- _x_d_r__d_e_s_t_r_o_y() is undefined.
-
-
- bool_t
- xdr_double(XDR *xdrs, double *dp)
-
-
- A filter primitive that translates between C _d_o_u_b_l_e precision
- numbers and their external representations. This routine returns 1
- if it succeeds, 0 otherwise.
-
-
- bool_t
- xdr_enum(XDR *xdrs, enum_t *ep)
-
-
- A filter primitive that translates between C _e_n_u_ms (actually
- integers) and their external representations. This routine returns
- 1 if it succeeds, 0 otherwise.
-
-
- bool_t
- xdr_float(XDR *xdrs, float *fp)
-
-
- A filter primitive that translates between C _f_l_o_a_ts and their
- external representations. This routine returns 1 if it succeeds, 0
- otherwise.
-
-
- void
- xdr_free(xdrproc_t proc, char *objp)
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- Generic freeing routine. The first argument is the XDR routine for
- the object being freed. The second argument is a pointer to the
- object itself. Note: the pointer passed to this routine is _n_o_t
- freed, but what it points to _i_s freed (recursively).
-
-
- u_int
- xdr_getpos(XDR *xdrs)
-
-
- A macro that invokes the get-position routine associated with the
- XDR stream, _x_d_r_s. The routine returns an unsigned integer, which
- indicates the position of the XDR byte stream. A desirable feature
- of XDR streams is that simple arithmetic works with this number,
- although the XDR stream instances need not guarantee this.
-
-
- long *
- xdr_inline(XDR *xdrs, int len)
-
-
- A macro that invokes the in-line routine associated with the XDR
- stream, _x_d_r_s. The routine returns a pointer to a contiguous piece
- of the stream's buffer; _l_e_n is the byte length of the desired
- buffer. Note: the pointer is cast to _l_o_n_g *.
-
- Warning: _x_d_r__i_n_l_i_n_e() may return NULL (0) if it cannot allocate a
- contiguous piece of a buffer. Therefore the behavior may vary among
- stream instances; it exists for the sake of efficiency.
-
-
- bool_t
- xdr_int(XDR *xdrs, int *ip)
-
-
- A filter primitive that translates between C integers and their
- external representations. This routine returns 1 if it succeeds, 0
- otherwise.
-
-
- bool_t
- xdr_long(XDR *xdrs, long *lp)
-
-
- A filter primitive that translates between C _l_o_n_g integers and their
- external representations. This routine returns 1 if it succeeds, 0
- otherwise.
-
- Warning: In the IRIX 64-bit ABI, this routine may be somewhat
- misleading. The external representation of a _l_o_n_g integer is defined
- by the XDR standard to be a 32 bit encoding, but in the IRIX 64-bit
- ABI, a _l_o_n_g integer is 64 bits. Hence, in the IRIX 64-bit ABI, _l_o_n_g
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- integers are truncated by _x_d_r__l_o_n_g(), and _x_d_r__l_o_n_g() is only useful
- for encoding/decoding values in the range of -2147483648 to
- 2147483647.
-
- bool_t
- xdr_longlong_t(XDR *xdrs, __int64_t *ulp)
-
-
- A filter primitive that translates between C _6_4-_b_i_t integers and
- their external representations. This routine returns 1 if it
- succeeds, 0 otherwise.
-
-
- bool_t
- xdr_opaque(XDR *xdrs, void *cp, u_int cnt)
-
-
- A filter primitive that translates between fixed size opaque data
- and its external representation. The parameter _c_p is the address of
- the opaque object, and _c_n_t is its size in bytes. This routine
- returns 1 if it succeeds, 0 otherwise.
-
-
- bool_t
- xdr_pointer(XDR *xdrs, char **objpp,
- u_int objsize, xdrproc_t xdrobj)
-
-
- Like _x_d_r__r_e_f_e_r_e_n_c_e() except that it serializes NULL pointers,
- whereas _x_d_r__r_e_f_e_r_e_n_c_e() does not. Thus, _x_d_r__p_o_i_n_t_e_r() can represent
- recursive data structures, such as binary trees or linked lists.
-
-
-
- bool_t
- xdr_reference(XDR *xdrs, char **pp,
- u_int size, xdrproc_t proc)
-
-
- A primitive that provides pointer chasing within structures. The
- parameter _p_p is the address of the pointer; _s_i_z_e is the _s_i_z_e_o_f the
- structure that *_p_p points to; and _p_r_o_c is an XDR procedure that
- filters the structure between its C form and its external
- representation. This routine returns 1 if it succeeds, 0 otherwise.
-
- Warning: this routine does not understand NULL pointers. Use
- _x_d_r__p_o_i_n_t_e_r() instead.
-
-
- bool_t
- xdr_setpos(XDR *xdrs, u_int pos)
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- A macro that invokes the set position routine associated with the
- XDR stream _x_d_r_s. The parameter _p_o_s is a position value obtained
- from _x_d_r__g_e_t_p_o_s(). This routine returns 1 if the XDR stream could
- be repositioned, and 0 otherwise.
-
- Warning: it is difficult to reposition some types of XDR streams, so
- this routine may fail with one type of stream and succeed with
- another.
-
-
- bool_t
- xdr_short(XDR *xdrs, short *sp)
-
-
- A filter primitive that translates between C _s_h_o_r_t integers and
- their external representations. This routine returns 1 if it
- succeeds, 0 otherwise.
-
-
- bool_t
- xdr_string(XDR *xdrs, char **sp, u_int maxsize)
-
-
- A filter primitive that translates between C strings and their
- corresponding external representations. Strings cannot be longer
- than _m_a_x_s_i_z_e. Note: _s_p is the address of the string's pointer.
- This routine returns 1 if it succeeds, 0 otherwise.
-
-
- bool_t
- xdr_u_char(XDR *xdrs, unsigned char *cp)
-
-
- A filter primitive that translates between _u_n_s_i_g_n_e_d C characters and
- their external representations. This routine returns 1 if it
- succeeds, 0 otherwise.
-
-
- bool_t
- xdr_u_int(XDR *xdrs, unsigned *up)
-
-
- A filter primitive that translates between C _u_n_s_i_g_n_e_d integers and
- their external representations. This routine returns 1 if it
- succeeds, 0 otherwise.
-
-
- bool_t
- xdr_u_long(XDR *xdrs, unsigned long *ulp)
-
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- A filter primitive that translates between C _u_n_s_i_g_n_e_d _l_o_n_g integers
- and their external representations. This routine returns 1 if it
- succeeds, 0 otherwise.
-
- Warning: In the IRIX 64-bit ABI, this routine may be somewhat
- misleading. The external representation of an _u_n_s_i_g_n_e_d _l_o_n_g integer
- is defined by the XDR standard to be a 32 bit encoding, but in the
- IRIX 64-bit ABI, an _u_n_s_i_g_n_e_d _l_o_n_g integer is 64 bits. Hence, in the
- IRIX 64-bit ABI, _u_n_s_i_g_n_e_d _l_o_n_g integers are truncated by
- _x_d_r__u__l_o_n_g(), and _x_d_r__u__l_o_n_g() is only useful for encoding/decoding
- values in the range of 0 to 4294967295.
-
-
- bool_t
- xdr_u_longlong_t(XDR *xdrs, __uint64_t *ulp)
-
-
- A filter primitive that translates between C _u_n_s_i_g_n_e_d _6_4-_b_i_t
- integers and their external representations. This routine returns 1
- if it succeeds, 0 otherwise.
-
-
- bool_t
- xdr_u_short(XDR *xdrs, unsigned short *usp)
-
-
- A filter primitive that translates between C _u_n_s_i_g_n_e_d _s_h_o_r_t integers
- and their external representations. This routine returns 1 if it
- succeeds, 0 otherwise.
-
-
- bool_t
- xdr_union(XDR *xdrs, enum_t *dscmp, void *unp,
- struct xdr_discrim *choices, xdrproc_t dfault)
-
-
- A filter primitive that translates between a discriminated C _u_n_i_o_n
- and its corresponding external representation. It first translates
- the discriminant of the union located at _d_s_c_m_p. This discriminant
- is always an _e_n_u_m__t. Next the union located at _u_n_p is translated.
- The parameter _c_h_o_i_c_e_s is a pointer to an array of _x_d_r__d_i_s_c_r_i_m()
- structures. Each structure contains an ordered pair of [_v_a_l_u_e,
- _p_r_o_c]. If the union's discriminant is equal to the associated
- _v_a_l_u_e, then the _p_r_o_c is called to translate the union. The end of
- the _x_d_r__d_i_s_c_r_i_m() structure array is denoted by a routine of value
- NULL. If the discriminant is not found in the _c_h_o_i_c_e_s array, then
- the _d_e_f_a_u_l_t_a_r_m procedure is called (if it is not NULL). Returns 1
- if it succeeds, 0 otherwise.
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 6666
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- bool_t
- xdr_vector(XDR *xdrs, char *arrp,
- u_int size, u_int elsize, xdrproc_t elproc)
-
-
- A filter primitive that translates between fixed-length arrays and
- their corresponding external representations. The parameter _a_r_r_p is
- the address of the pointer to the array, while _s_i_z_e is the element
- count of the array. The parameter _e_l_s_i_z_e is the _s_i_z_e_o_f each of the
- array's elements, and _e_l_p_r_o_c is an XDR filter that translates
- between the array elements' C form, and their external
- representation. This routine returns 1 if it succeeds, 0 otherwise.
-
-
- bool_t
- xdr_void(XDR *xdrs, void *v)
-
-
- This routine always returns 1. It may be passed to RPC routines
- that require a function parameter, where nothing is to be done.
-
-
- bool_t
- xdr_wrapstring(XDR *xdrs, char **sp)
-
-
- A primitive that calls
-
- xdr_string(xdrs, sp, UINT_MAX);
-
- where _U_I_N_T__M_A_X is the maximum value of an unsigned integer, as
- defined in <_l_i_m_i_t_s._h>. _x_d_r__w_r_a_p_s_t_r_i_n_g() is handy because the RPC
- package passes a maximum of two XDR routines as parameters, and
- _x_d_r__s_t_r_i_n_g(), one of the most frequently used primitives, requires
- three. Returns 1 if it succeeds, 0 otherwise.
-
-
- void
- xdrmem_create(XDR *xdrs, void *addr,
- u_int size, enum xdr_op op)
-
-
- This routine initializes the XDR stream object pointed to by _x_d_r_s.
- The stream's data is written to, or read from, a chunk of memory at
- location _a_d_d_r whose length is no more than _s_i_z_e bytes long. The _o_p
- determines the direction of the XDR stream (either XXXXDDDDRRRR____EEEENNNNCCCCOOOODDDDEEEE,
- XXXXDDDDRRRR____DDDDEEEECCCCOOOODDDDEEEE, or XXXXDDDDRRRR____FFFFRRRREEEEEEEE).
-
-
- void
- xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize,
- void *handle,
-
-
-
- PPPPaaaaggggeeee 7777
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- int (*readit)(void *, void *, u_int),
- int (*writeit)(void *, void *, u_int))
-
-
- This routine initializes the XDR stream object pointed to by _x_d_r_s.
- The stream's data is written to a buffer of size _s_e_n_d_s_i_z_e; a value
- of 0 indicates the system should use a suitable default. The
- stream's data is read from a buffer of size _r_e_c_v_s_i_z_e; it too can be
- set to a suitable default by passing a zero value. When a stream's
- output buffer is full, _w_r_i_t_e_i_t is called. Similarly, when a
- stream's input buffer is empty, _r_e_a_d_i_t is called. The behavior of
- these two routines is similar to the system calls _r_e_a_d(2) and
- _w_r_i_t_e(2), except that _h_a_n_d_l_e is passed to the former routines as the
- first parameter. Note: the XDR stream's _o_p field must be set by the
- caller.
-
- Warning: this XDR stream implements an intermediate record stream.
- Therefore there are additional bytes in the stream to provide record
- boundary information.
-
-
- bool_t
- xdrrec_endofrecord(XDR *xdrs, bool_t sendnow)
-
-
- This routine can be invoked only on streams created by
- _x_d_r_r_e_c__c_r_e_a_t_e(). The data in the output buffer is marked as a
- completed record, and the output buffer is optionally written out if
- _s_e_n_d_n_o_w is non-zero. This routine returns 1 if it succeeds, 0
- otherwise.
-
-
- bool_t
- xdrrec_eof(XDR *xdrs)
-
-
- This routine can be invoked only on streams created by
- _x_d_r_r_e_c__c_r_e_a_t_e(). After consuming the rest of the current record in
- the stream, this routine returns 1 if the stream has no more input,
- 0 otherwise.
-
-
- int
- xdrrec_readbytes(XDR *xdrs, caddr_t addr, u_int len)
-
-
- This routine reads data from the stream. It behaves like the _r_e_a_d(2)
- system call against a pipe - it returns up to the number of bytes
- requested and a return of zero indicates end-of-record. A -1 means
- something very bad happened.
-
-
-
-
-
- PPPPaaaaggggeeee 8888
-
-
-
-
-
-
- XXXXDDDDRRRR((((3333RRRR)))) XXXXDDDDRRRR((((3333RRRR))))
-
-
-
- bool_t
- xdrrec_skiprecord(XDR *xdrs)
-
-
- This routine can be invoked only on streams created by
- _x_d_r_r_e_c__c_r_e_a_t_e(). It tells the XDR implementation that the rest of
- the current record in the stream's input buffer should be discarded.
- This routine returns 1 if it succeeds, 0 otherwise.
-
-
- void
- xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op)
-
-
- This routine initializes the XDR stream object pointed to by _x_d_r_s.
- The XDR stream data is written to, or read from, the Standard _I/_O
- stream _f_i_l_e. The parameter _o_p determines the direction of the XDR
- stream (either XXXXDDDDRRRR____EEEENNNNCCCCOOOODDDDEEEE, XXXXDDDDRRRR____DDDDEEEECCCCOOOODDDDEEEE, or XXXXDDDDRRRR____FFFFRRRREEEEEEEE).
-
- Warning: the destroy routine associated with such XDR streams calls
- _f_f_l_u_s_h(3S) on the _f_i_l_e stream, but never _f_c_l_o_s_e(3S).
-
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- rpc(3R), _I_R_I_X _N_e_t_w_o_r_k _P_r_o_g_r_a_m_m_i_n_g _G_u_i_d_e.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 9999
-
-
-
-